package com.xumz.controller.tool;

import java.util.Calendar;
import java.util.Random;

public class IDFactoty {
	public static String productIdByDateTime(){
		Calendar cal = Calendar.getInstance();
		int year = cal.get(Calendar.YEAR);//获取年份
		int month=cal.get(Calendar.MONTH);//获取月份 
		int day=cal.get(Calendar.DATE);//获取日 
		int hour=cal.get(Calendar.HOUR);//小时 
		int minute=cal.get(Calendar.MINUTE);//分            
		int second=cal.get(Calendar.SECOND);//秒 
		int WeekOfYear = cal.get(Calendar.DAY_OF_WEEK);//一周的第几天
		Random random=new Random();
		int idFoot=random.nextInt(9999);
		String ID=""+year+month+day+hour+minute+second+WeekOfYear+idFoot;
//		System.out.println("现在的时间是：公元"+year+"年"+month+"月"+day+"日      "+hour+"时"+minute+"分"+second+"秒       星期"+WeekOfYear);
		return ID;
	}
}
